package com.serviceImpl;

import com.dao.CompanyDao;
import com.model.company;
import com.service.CompanyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/9/6 0006.
 */
@Service
public class CompanyServiceImpl implements CompanyService {
    @Resource
    private CompanyDao CompanyDao;
    @Override
    public List<company> getCompanyListdo(company company) {
        return CompanyDao.getCompanyListdo(company);
    }

    @Override
    public int insertCompany(company company) {
        return CompanyDao.insertCompany(company);
    }

    @Override
    public int modifyCompany(company company) {
        return CompanyDao.modifyCompany(company);
    }

    @Override
    public int modifyCompanyPassword(company company) {
        return CompanyDao.modifyCompanyPassword(company);
    }

    @Override
    public int deleteCompany(int id) {
        return CompanyDao.deleteCompany(id);
    }

    @Override
    public int selectCompanyCount(company company) {
        return CompanyDao.selectCompanyCount(company);
    }

    @Override
    public boolean isCompanyName(String CompanyName) {
        List<company> companyNames= CompanyDao.selectCompanyName();
        for (company company:companyNames ) {
            if(CompanyName.equals(company.getCompanyName())){
                return true;
            };
        }
        return false;
    }

    @Override
    public boolean isCompanyuserName(String usrename) {
        List<company> companyNames= CompanyDao.selectCompanyusername();
        for (company company:companyNames ) {
            if(usrename.equals(company.getUsername())){
                return true;
            };
        }
        return false;
    }
}
